//
//  addMemberViewController.m
//  pe_score
//
//  Created by zwz on 16/6/27.
//  Copyright © 2016年 zhangwz. All rights reserved.
//

#import "addMemberViewController.h"

@interface addMemberViewController ()<UITextFieldDelegate>
@end

@implementation addMemberViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self addGesture];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)confirm:(id)sender {
    
    NSString *urlString = [NSString stringWithFormat:@"http://23.105.222.161/abc/addmember.php?memberName=%@&teamName=%@&memberAge=%@&memberNum=%@&memberPlace=%@&memberHigh=%@&memberWeight=%@",_memberName.text,_teamName.text,_memberAge.text,_memberNum.text,_memberPlace.text,_memberHigh.text,_memberWeight.text];
    NSURL *url=[NSURL URLWithString:urlString];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        }];
    
    NSLog(@"%@",url);
    
    [self.navigationController popToRootViewControllerAnimated:YES];
}


-(void)addGesture
{
    UITapGestureRecognizer *tap1=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewtaped:)];
    tap1.cancelsTouchesInView=NO;
    [self.view addGestureRecognizer:tap1];
}


-(void)viewtaped:(UIGestureRecognizer *)tap1
{
    [self.view endEditing:YES];
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}


@end
